<?php

class HTML_Output extends Output {

	protected $head = array();

	public static function Load_Output($name = null){
		if(!isset($name)){ parent::Load_Output(); }
		return new HTML_Output();
	}

	public function Template($tpl, $data = array()){
		array_unshift($tpl, "html");
		$data['html'] = $this;
		$template = Theme::GetInstance()->template($tpl, $data);
		return $template;
	}

	public function base_url(){
		return Site::getInstance()->getValue('url_root');
	}

	public function head($location, $function){
		$this->head[$location] = $function;
	}

	public function Display($tpl){
		$template = Output::getInstance()->Template(array('index'));
		$template->main = $tpl;
		foreach($this->head as $func){
			$template->head[] = $func;
		}


		header('Content-type: text/html');
		$template->display();
	}

}
